package com.by.service.impl;

import com.by.bean.Management;
import com.by.common.bean.PageBean;
import com.by.common.crud.BaseServiceImpl;
import com.by.mapper.ManagementMapper;
import com.by.service.ManagementService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * @author HY
 * @version 1.0
 * @description
 * @date 2025/2/14
 * @since JDK21
 */
@Service
public class ManagementServiceImpl extends BaseServiceImpl<Management,ManagementMapper> implements ManagementService {

    @Autowired
    ManagementMapper managementMapper;


    @Override
    public PageBean query(int page, int pageSize) {
       PageHelper.startPage(page,pageSize);
       List list=managementMapper.query();
       PageInfo pageInfo=new PageInfo(list);
       return new PageBean(page,pageSize,(int)pageInfo.getTotal(),list);
    }


    @Override
    public int save(Management entity) {
        return managementMapper.save(entity);
    }



    @Override
    public Management queryByName(String username) {
        return managementMapper.queryByName(username);

    }

    @Override
    public int delete(String id) {
        return   managementMapper.delete(id);
    }

    @Override
    public int update(Management entity) {
      return  managementMapper.update(entity);

    }
}
